"use strict";
cc._RF.push(module, '70dfadr/ndMdJZXyjmqdzIw', 'cloudFloat');
// scripts/engines/components/cloudFloat.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var data_control_1 = require("../libs/data_control");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var cloudFloat = /** @class */ (function (_super) {
    __extends(cloudFloat, _super);
    function cloudFloat() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.minTime = 1;
        _this.maxTime = 3;
        _this.targetYMinDistance = 20;
        _this.targetYMaxDistance = 50;
        _this.initY = 0;
        return _this;
    }
    cloudFloat.prototype.start = function () {
        this.initY = this.node.y;
        this.cloudAni();
    };
    cloudFloat.prototype.cloudAni = function () {
        var _this = this;
        var randTime = data_control_1.default.getRandNumberOfArrayTwo([this.minTime, this.maxTime]);
        var targetY = this.initY + data_control_1.default.getRandNumberOfArrayTwo([this.targetYMinDistance, this.targetYMaxDistance]);
        cc.tween(this.node).to(randTime / 2, { y: targetY }).delay(0.1).to(randTime / 2, { y: this.initY }).delay(0.1).call(function () {
            _this.cloudAni();
        }).start();
    };
    __decorate([
        property({ tooltip: "最短时间" })
    ], cloudFloat.prototype, "minTime", void 0);
    __decorate([
        property({ tooltip: "最长时间" })
    ], cloudFloat.prototype, "maxTime", void 0);
    __decorate([
        property({ tooltip: "对于初始位置Y轴的最短目标距离" })
    ], cloudFloat.prototype, "targetYMinDistance", void 0);
    __decorate([
        property({ tooltip: "对于初始位置Y轴的最长目标距离" })
    ], cloudFloat.prototype, "targetYMaxDistance", void 0);
    cloudFloat = __decorate([
        ccclass
    ], cloudFloat);
    return cloudFloat;
}(cc.Component));
exports.default = cloudFloat;

cc._RF.pop();